//
//  ReaderViewController.h
//  Jula_iOS
//
//  Created by adiljan on 16/3/19.
//  Copyright © 2016年 Alimjan. All rights reserved.
//




#import <UIKit/UIKit.h>
#import "BaseViewController.h"
#import "ZipArchive.h"
#import "BookLoader.h"
#import "Chapter.h"
#import "ResourceHelper.h"
#import "MBProgressHUD.h"//正在加载视图
#import "FileHelper.h"//文件操作类
#import "uyConverter.h"
#import "IconButton.h"
#import "ReadToolbarView.h"
#import "ReaderBackView.h"
#import "ReaderLightView.h"
#import "ReaderPageView.h"
#import "Reader_listView.h"
#import "EPub.h"
//#import "JKBrightnessAlert.h"
//#import "DXAlertView.h"



//#define IOS7 ([[[[UIDevice currentDevice] systemVersion] substringToIndex:1] intValue]>=7)

#define PHONE_WIDTH [UIScreen mainScreen].bounds.size.width
@interface ReaderViewController : BaseViewController <UIGestureRecognizerDelegate,UIWebViewDelegate, ChapterDelegate, UISearchBarDelegate,MBProgressHUDDelegate>
{
    NSData* htmlData;
    NSString* strBackGroundCSS;
    BOOL isNightMode;  // 是否是夜晚状态
    
    BOOL isHiddenLightView;  // 调节音量view是否是显示状态
    BOOL isHiddenPageView;  // 页码view是否是显示状态
    BOOL isHiddenReaderList;  // 目录view是否是显示状态
    
    IconButton *btnList;
    UIView *viewBac;
    UIButton *btnDiss;
    UITapGestureRecognizer *singleFingerOne;
    UIPanGestureRecognizer *pan;
    
    NSTimer *timer;
    UISlider *mSlider;
    UILabel *popView;
    NSURL *epubUrl;
    
    UIPopoverController* chaptersPopover;
    UIPopoverController* searchResultsPopover;
//    int targetPage;
    
    float floatOffSet;
    float lastOffset;
    
}

@property (strong, nonatomic) UIWindow *window;

- (void) showChapterIndex:(id)sender;
- (void) increaseTextSizeClicked:(id)sender;
- (void) decreaseTextSizeClicked:(id)sender;
- (void) slidingStarted:(id)sender;
- (void) slidingEnded:(id)sender;
- (void) doneClicked:(id)sender;
- (void) loadBook:(NSNotification *)notification;

@property(nonatomic,strong)NSString* strUpubPath;

@property (nonatomic, strong) ReadToolbarView *toolbar;

@property (nonatomic, strong) Reader_listView *tblReaderList;


@property (nonatomic, strong) ReaderBackView *backbar;

@property (nonatomic, retain) EPub* loadedEpub;

@property (nonatomic, strong) ReaderLightView *lightView;

@property (nonatomic, strong) ReaderPageView *pageView;

@property (nonatomic,retain)  MBProgressHUD *hud;
@property (nonatomic, retain) BookLoader *bookLoader;
//@property (nonatomic, retain) UIView *headerbar;
//@property (nonatomic, retain) UIView *toolbar;
@property (nonatomic, retain) UIWebView *webView;
@property (nonatomic, retain) IconButton *btnLight;
@property (nonatomic, retain) IconButton *btnReadMode;
@property (nonatomic, retain) IconButton *btnSmallFont;
@property (nonatomic, retain) IconButton *btnBigFont;
@property (nonatomic, retain) IconButton *btnShowPage;
//@property (nonatomic, retain) UISlider *pageSlider;
@property (nonatomic, retain) UILabel *currentPageLabel;
@property (nonatomic, retain) UILabel *currentPageLabel2;
@property (nonatomic, copy)NSArray * arrList;
@property BOOL epubLoaded;
@property BOOL paginating;
@property BOOL enablePaging;
@property BOOL searching;
@property BOOL isClearWebViewContent;
@property int currentSpineIndex;
@property int currentPageInSpineIndex;
@property int pagesInCurrentSpineCount;
@property int currentTextSize;
@property int totalPagesCount;

- (void) loadSpine:(int)spineIndex atPageIndex:(int)pageIndex;

@end

